﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.master" AutoEventWireup="true" CodeBehind="DeliveryStatus.aspx.cs" Inherits="GPSTracker.Views.Report.DeliveryStatus" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <link href="../CSS/DeliveryStatus.css" rel="stylesheet" />

    <script language="javascript" type="text/javascript">

        function Fade(div) {
            setTimeout("document.getElementById('" + div + "').style.display='none'", 4000);
        }

    </script>

    <script src="../JS/jquery-1.10.2.js"></script>


    <asp:ScriptManager ID="scrptMgr" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpMain" runat="server" UpdateMode="Conditional">
        <ContentTemplate>

            <script type="text/javascript">
                $(window).ready(function () {

                    var ht = window.innerHeight - 150;
                    $('#container').css('height', ht);

                });
                $(window).resize(function () {

                    var ht = window.innerHeight - 150;
                    $('#container').css('height', ht);

                });
                var prm = Sys.WebForms.PageRequestManager.getInstance();

                prm.add_endRequest(function () {
                    var ht = window.innerHeight - 150;
                    $('#container').css('height', ht);
                });
            </script>


            <style type="text/css">
                #container {
                    position: relative;
                    min-height: 150px;
                }

                #sidebar {
                    position: absolute;
                    left: 0;
                    top: 0;
                    height: 100%;
                    width: 100%;
                    overflow-y: scroll;
                }
            </style>


            <div id="container">
                <div id="sidebar">

                    <table cellspacing="5" cellpadding="5" width="98%" border="0" align="center">
                        <tr>
                            <td style="width: 100%; height: 100%; text-align: center;">
                                <fieldset class="FiledSetDesign">
                                    <legend class="PageHeading" align="center">
                                        <asp:Label ID="lblHead" runat="server" Text="Delivery Status - Report"></asp:Label>
                                    </legend>
                                    <table style="width: 100%; height: 100%" align="center" cellspacing="0" cellpadding="0">
                                        <tr>
                                            <td style="padding: 5px; width: 100%; height: 100%; overflow: auto;">
                                                <dx:ASPxGridView ID="grid" ClientInstanceName="grid" runat="server" KeyFieldName="DeliveryEntryID" Width="100%" DataSourceID="masterDataSource"
                                                    AutoGenerateColumns="False" OnCustomButtonCallback="grdView_CustomButtonCallback" EnableCallBacks="false">
                                                    <Columns>
                                                        <dx:GridViewCommandColumn VisibleIndex="0">
                                                            <ClearFilterButton Visible="True">
                                                            </ClearFilterButton>
                                                            <CustomButtons>
                                                                <dx:GridViewCommandColumnCustomButton ID="btnView" Text="View">
                                                                </dx:GridViewCommandColumnCustomButton>
                                                            </CustomButtons>
                                                        </dx:GridViewCommandColumn>

                                                        <dx:GridViewDataColumn FieldName="DeliveryEntryID" VisibleIndex="1" Visible="false"></dx:GridViewDataColumn>

                                                        <dx:GridViewDataColumn FieldName="VoucherNo" Caption="Voucher No." VisibleIndex="2"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="OrderNo" Caption="Order No." VisibleIndex="3"></dx:GridViewDataColumn>

                                                        <dx:GridViewDataDateColumn FieldName="OrderDate" Caption="Order Date" VisibleIndex="4">
                                                            <PropertiesDateEdit DisplayFormatString="dd-MMM-yyyy">
                                                            </PropertiesDateEdit>
                                                        </dx:GridViewDataDateColumn>

                                                        <dx:GridViewDataColumn FieldName="BillNo" Caption="Bill No." VisibleIndex="5"></dx:GridViewDataColumn>

                                                        <dx:GridViewDataDateColumn FieldName="BillDate" Caption="Bill Date" VisibleIndex="6">
                                                            <PropertiesDateEdit DisplayFormatString="dd-MMM-yyyy">
                                                            </PropertiesDateEdit>
                                                        </dx:GridViewDataDateColumn>

                                                        <dx:GridViewDataColumn FieldName="WhouseCode" Caption="Warehouse Code" VisibleIndex="7"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="BranchCode" Caption="Branch Code" VisibleIndex="8"></dx:GridViewDataColumn>

                                                        <dx:GridViewDataColumn FieldName="AreaName" Caption="Area" VisibleIndex="9"></dx:GridViewDataColumn>

                                                        <dx:GridViewDataColumn FieldName="CustName" Caption="Customer Name" VisibleIndex="10"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="Address1" Caption="Address 1" VisibleIndex="11"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="Address2" Caption="Address 2" VisibleIndex="12"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="Address3" Caption="Address 3" VisibleIndex="13"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="Address4" Caption="Address 4" VisibleIndex="14"></dx:GridViewDataColumn>

                                                        <dx:GridViewDataColumn FieldName="City" Caption="City" VisibleIndex="15"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="Pincode" Caption="Pincode" VisibleIndex="16"></dx:GridViewDataColumn>

                                                        <dx:GridViewDataColumn FieldName="ContactNo" Caption="Contact No" VisibleIndex="17"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="EmailID" Caption="Email ID" VisibleIndex="18"></dx:GridViewDataColumn>

                                                        <dx:GridViewDataColumn FieldName="MODEL_CODE" Caption="Model Code" VisibleIndex="19"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="MODEL_TYPE" Caption="Model Type" VisibleIndex="20"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="ITEM_DESC" Caption="Item Desc" VisibleIndex="21"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="CHASIS_NO" Caption="Chasis No." VisibleIndex="22"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="Qty" Caption="Quantity" VisibleIndex="23"></dx:GridViewDataColumn>

                                                        <dx:GridViewDataColumn FieldName="TempoNo" Caption="Tempo No" VisibleIndex="24"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="DispatchBy" Caption="Dispatch By" VisibleIndex="25"></dx:GridViewDataColumn>

                                                        <dx:GridViewDataDateColumn FieldName="DispatchDttm" Caption="Dispatch Dttm" VisibleIndex="26">
                                                            <PropertiesDateEdit DisplayFormatString="dd-MMM-yyyy hh:mm tt">
                                                            </PropertiesDateEdit>
                                                        </dx:GridViewDataDateColumn>

                                                        <dx:GridViewDataColumn FieldName="DeliveryBoy" Caption="Delivery Boy" VisibleIndex="27"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="IsDelivered" Caption="Is Delivered" VisibleIndex="28"></dx:GridViewDataColumn>

                                                        <dx:GridViewDataDateColumn FieldName="DeliveredDttm" Caption="Delivered Dttm" VisibleIndex="29">
                                                            <PropertiesDateEdit DisplayFormatString="dd-MMM-yyyy hh:mm tt">
                                                            </PropertiesDateEdit>
                                                        </dx:GridViewDataDateColumn>

                                                    </Columns>

                                                    <Templates>
                                                        <DetailRow>
                                                            <dx:ASPxGridView ID="detailGrid" runat="server" DataSourceID="detailDataSource" KeyFieldName="DeliveryStatusID"
                                                                OnBeforePerformDataSelect="detailGrid_DataSelect">
                                                                <Columns>
                                                                    <dx:GridViewDataColumn FieldName="DeliveryStatusID" VisibleIndex="1" Visible="false" />
                                                                    <dx:GridViewDataColumn FieldName="Status" VisibleIndex="2" Caption="Status" />

                                                                    <dx:GridViewDataDateColumn FieldName="StatusDttm" VisibleIndex="3" Caption="Status DateTime">
                                                                        <PropertiesDateEdit DisplayFormatString="dd-MMM-yyyy hh:mm tt">
                                                                        </PropertiesDateEdit>
                                                                    </dx:GridViewDataDateColumn>

                                                                    <dx:GridViewDataColumn FieldName="CreatedBy" VisibleIndex="4" Caption="Created By" />
                                                                </Columns>
                                                            </dx:ASPxGridView>
                                                        </DetailRow>
                                                    </Templates>
                                                    <SettingsDetail ShowDetailRow="true" />
                                                    <Settings ShowFilterRow="True" HorizontalScrollBarMode="Auto" />
                                                    <SettingsBehavior ColumnResizeMode="Control" />
                                                    <SettingsPager>
                                                        <PageSizeItemSettings Visible="true" />
                                                    </SettingsPager>

                                                    <ClientSideEvents CustomButtonClick="function(s, e) {
                                                                if(e.buttonID == 'btnView')
                                                                {
                                                                    e.processOnServer = true;
                                                                }
                                                            }" />

                                                </dx:ASPxGridView>

                                                <asp:SqlDataSource ID="masterDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MainConn %>"
                                                    SelectCommand="SP_GetDeliveryStatus_REPORT" SelectCommandType="StoredProcedure"></asp:SqlDataSource>

                                                <asp:SqlDataSource ID="detailDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MainConn %>"
                                                    SelectCommand="SP_GetDeliveryDetailStatus_REPORT" SelectCommandType="StoredProcedure">
                                                    <SelectParameters>
                                                        <asp:SessionParameter SessionField="DeliveryEntryID" Name="pDeliveryEntryID" Type="Int32"></asp:SessionParameter>
                                                    </SelectParameters>
                                                </asp:SqlDataSource>
                                            </td>
                                        </tr>

                                    </table>
                                </fieldset>
                            </td>
                        </tr>
                    </table>


                    <dx:ASPxPopupControl ID="popup" ClientInstanceName="popup" runat="server" AllowDragging="true" ShowShadow="False"
                        PopupHorizontalAlign="WindowCenter" HeaderText="View Delivery Status" PopupVerticalAlign="WindowCenter">
                        <ContentCollection>
                            <dx:PopupControlContentControl ID="PopupControlContentControl1" runat="server">
                                <table style="width: 100%;">
                                    <tr>
                                        <td rowspan="3" style="padding-right: 5px">
                                            <dx:ASPxImage runat="server" ID="ImgCustPhoto" Width="400px" AlternateText="Customer Photo" IsPng="True" ToolTip="Customer Photo" ShowLoadingImage="True" >
                                            </dx:ASPxImage>
                                        </td>
                                        <td>
                                            <dx:ASPxImage runat="server" ID="ImgCustSing" Width="400px" AlternateText="Customer Sign" IsPng="True" ToolTip="Customer Sign" Height="200px" ShowLoadingImage="True"/>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td colspan="2" style="padding-top: 10px">
                                            <dx:ASPxMemo runat="server" ID="txtFeedback" Width="400px" Height="245px" ReadOnly="true" />
                                        </td>
                                    </tr>
                                </table>
                            </dx:PopupControlContentControl>
                        </ContentCollection>
                    </dx:ASPxPopupControl>

                </div>
            </div>

        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
